const ua = window.navigator.userAgent;
let path
if(ua.indexOf('iPad') >= 0){
  path = '/iPad'
}else if(ua.indexOf('iPhone') >= 0){
  path = '/mobile'
}else if(ua.indexOf('Android') >= 0){
  path = '/mobile'
}else{
  path = ''
}
const routers = [
  {
    path: '/',
    meta: {
      title: '登陆'
    },
    name: "login",
    component: (resolve) => require(['./views'+ path +'/login/login.vue'], resolve)
  },
  {
    path: '/forget',
    meta: {
      title: '忘记密码'
    },
    name: "forget",
    component: (resolve) => require(['./views/login/forget.vue'], resolve)
  },
  {
    path: '/index',
    meta: {
      title: '首页'
    },
    name: "index",
    component: (resolve) => require(['./views/index.vue'], resolve)
  },
  {
    path: '/company',
    meta: {
      title: '走进世贸'
    },
    name: "company",
    component: (resolve) => require(['./views/company.vue'], resolve)
  },
  {
    path: '/news',
    meta: {
      title: '世贸动态'
    },
    name: "news",
    component: (resolve) => require(['./views/news.vue'], resolve)
  },
  {
    path: '/recreation',
    meta: {
      title: '世贸服务'
    },
    name: "recreation",
    redirect: "/recreation/culture",
    component: (resolve) => require(['./views/recreation.vue'], resolve),
    children: [
      {
        path: 'culture',
        meta: {
          title: '文化娱乐'
        },
        name: "culture",
        component: (resolve) => require(['./views/recreation/culture.vue'], resolve),
      },
      {
        path: 'serve',
        meta: {
          title: '服务中心'
        },
        name: "serve",
        component: (resolve) => require(['./views/recreation/serve.vue'], resolve),
      },
      {
        path: 'member',
        meta: {
          title: '会员中心'
        },
        name: "member",
        component: (resolve) => require(['./views/recreation/member.vue'], resolve),
      },
      {
        path: 'consult',
        meta: {
          title: '咨询中心'
        },
        name: "consult",
        component: (resolve) => require(['./views/recreation/consult.vue'], resolve),
      },
    ]
  },
  {
    path: '/invest',
    meta: {
      title: '招商引资'
    },
    name: "invest",
    redirect: "/invest/investment",
    component: (resolve) => require(['./views/invest.vue'], resolve),
    children: [
      {
        path: "investment",
        meta: {
          title: '投资新闻'
        },
        name: "invest",
        component: (resolve) => require(['./views/invest/investment.vue'], resolve),
      },
      {
        path: "policy",
        meta: {
          title: '投资政策'
        },
        name: "policy",
        component: (resolve) => require(['./views/invest/policy.vue'], resolve),
      },
      {
        path: "environment",
        meta: {
          title: '投资环境'
        },
        name: "environment",
        component: (resolve) => require(['./views/invest/environment.vue'], resolve),
      },
      {
        path: "feature",
        meta: {
          title: '运营特色'
        },
        name: "feature",
        component: (resolve) => require(['./views/invest/feature.vue'], resolve),
      },
      {
        path: "hire",
        meta: {
          title: '商铺租赁'
        },
        name: "hire",
        component: (resolve) => require(['./views/invest/hire.vue'], resolve),
      },
      {
        path: "traffic",
        meta: {
          title: '区位交通'
        },
        name: "traffic",
        component: (resolve) => require(['./views/invest/traffic.vue'], resolve),
      },
    ]
  },
  {
    path: '/about',
    meta: {
      title: '关于我们'
    },
    name: "about",
    redirect: "/about/synopsis",
    component: (resolve) => require(['./views/about.vue'], resolve),
    children: [
      {
        path: 'synopsis',
        meta: {
          title: '集团简介'
        },
        name: "synopsis",
        component: (resolve) => require(['./views/about/synopsis.vue'], resolve),
      },
      {
        path: 'relation',
        meta: {
          title: '联系我们'
        },
        name: "relation",
        component: (resolve) => require(['./views/about/relation.vue'], resolve),
      },
      {
        path: 'suggest',
        meta: {
          title: '投诉建议'
        },
        name: "suggest",
        component: (resolve) => require(['./views/about/suggest.vue'], resolve),
      },
      {
        path: 'recruit',
        meta: {
          title: '招贤纳士'
        },
        name: "recruit",
        component: (resolve) => require(['./views/about/recruit.vue'], resolve),
      },
    ]
  },
];
export default routers;